/*
 * @Author: wuqingchun
 * @Date: 2024-12-05 10:58:56
 * @Description: 
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-12-11 12:41:50
 */

#include <initializer_list>
#include <array>
#include <vector>
#include <string>
#include <cstddef>
#include <iostream>
    #include <chrono>

enum Type {
    // Numeric types should go first.
    INT, UINT, LONG, ULONG, LONG_LONG, ULONG_LONG, DOUBLE, LONG_DOUBLE,
    LAST_NUMERIC_TYPE = LONG_DOUBLE,
    CHAR, STRING, WSTRING, POINTER, CUSTOM
};

struct StringValue {
  const char *value;
  std::size_t size;
};

struct CustomValue {
    const void *value;
    //FormatFunc format;
};

class Argument
{
public:
    Type m_enType;
    union {
      int int_value;
      unsigned uint_value;
      double double_value;
      long long_value;
      unsigned long ulong_value;
      long long long_long_value;
      unsigned long long ulong_long_value;
      long double long_double_value;
      const void *pointer_value;
      StringValue string;
      CustomValue custom;
    };

    Argument(short value): m_enType(INT), int_value(value) {}
    Argument(unsigned short value): m_enType(UINT), uint_value(value) {}
    Argument(int value): m_enType(INT), int_value(value) {}
    Argument(unsigned int value): m_enType(UINT), uint_value(value) {}
    Argument(double value): m_enType(DOUBLE), double_value(value) {}
    Argument(const char* value): m_enType(STRING)
    {
        string.value = value;
        string.size = 0;
    }
};

class Formatter
{
private:
    std::vector<const Argument*> m_vecArgs;

public:
    Formatter(const char* fmt, std::initializer_list<Argument> args)
    {
        for (const Argument& item : args)
        {
            m_vecArgs.push_back(&item);
        }
    }
};

template <typename... Args>
std::string format(const std::string& refFmt, Args&&... args)
{
    Formatter formatter(refFmt.c_str(), {std::forward<Args>(args)...});
}


int32_t __AdjustTime(int32_t iTime)
{
    if (iTime >= 203000)
    {
        iTime -= 200000; // 减20个小时 
    }
    else
    {
        iTime += 40000; // 加4个小时
    }

    return iTime;
}

int main(int argc, char** argv)
{
    //format("one={}, two={}, three={}", 1, 2.1, "300");

    if (argc > 1)
    {
        std::cout << argv[1] << ": " << __AdjustTime(atoi(argv[1])) << std::endl;
    }


    
}